---
title: 'Report Post'
description: 'Comprehensive guide to all available actions in the OASIS simulation environment'
---

# Report Post

This cookbook provides a comprehensive guide to running a Twitter simulation using OASIS, including the post reporting feature.

## Overview

The REPORT_POST action type enables you to:
- Report inappropriate or harmful content
- Track reporting history
- Analyze reporting patterns
- Maintain platform content quality

## Key Features

- **Manual Report Actions**: Use `ManualAction` with `ActionType.REPORT_POST` to report posts
- **Automatic Report Tracking**: The system automatically collects and stores report information
- **Database Storage**: All report data is stored in the report table for later analysis
- **Concurrent Execution**: Reports can be submitted alongside other social media actions
- **Warning Message Display**: Warning messages are shown when the number of reports exceeds the threshold

## Important Note

The `ActionType.REPORT_POST` should be included in the `available_actions` list when creating your agent graph, as it's a regular social media action that agents can perform.

## Complete Example

```python
import asyncio
import os
import json
import sqlite3

from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType

import oasis
from oasis import (ActionType, LLMAction, ManualAction,
                   generate_twitter_agent_graph)


async def main():
    # Create model instance
    openai_model = ModelFactory.create(
        model_platform=ModelPlatformType.OPENAI,
        model_type=ModelType.GPT_4O_MINI,
    )

    # Define available actions for agents
    available_actions = [
        ActionType.CREATE_POST,
        ActionType.LIKE_POST,
        ActionType.REPORT_POST,  # Add post reporting functionality
        ActionType.REPOST,
        ActionType.FOLLOW,
        ActionType.DO_NOTHING,
    ]

    # Create agent graph
    agent_graph = await generate_twitter_agent_graph(
        profile_path=("data/twitter_dataset/anonymous_topic_200_1h/"
                      "False_Business_0.csv"),
        model=openai_model,
        available_actions=available_actions,
    )

    # Define database path
    db_path = "./data/twitter_simulation.db"

    # Remove old database
    if os.path.exists(db_path):
        os.remove(db_path)

    # Create environment
    env = oasis.make(
        agent_graph=agent_graph,
        platform=oasis.DefaultPlatformType.TWITTER,
        database_path=db_path,
    )

    # Run environment
    await env.reset()

    # Step 1: Agent 0 creates a post
    actions_1 = {}
    actions_1[env.agent_graph.get_agent(0)] = ManualAction(
        action_type=ActionType.CREATE_POST,
        action_args={"content": "Earth is flat."})
    await env.step(actions_1)

    # Step 2: Let some agents respond with LLM actions
    actions_2 = {
        agent: LLMAction()
        for _, agent in env.agent_graph.get_agents([1, 3, 5, 7, 9])
    }
    await env.step(actions_2)

    # Step 3: Agent 1 creates another post, Agent 0 reports the first post
    actions_3 = {}
    actions_3[env.agent_graph.get_agent(1)] = ManualAction(
        action_type=ActionType.CREATE_POST,
        action_args={"content": "Earth is not flat."})

    # Create report action
    actions_3[env.agent_graph.get_agent(0)] = ManualAction(
        action_type=ActionType.REPORT_POST,
        action_args={
            "post_id": 1,
            "report_reason": "This is misinformation!"
        })

    await env.step(actions_3)

    # Step 4: Let other agents respond
    actions_4 = {
        agent: LLMAction()
        for _, agent in env.agent_graph.get_agents([2, 4, 6, 8, 10])
    }
    await env.step(actions_4)

    # Step 5: Interview multiple agents
    actions_5 = {}
    actions_5[env.agent_graph.get_agent(0)] = ManualAction(
        action_type=ActionType.INTERVIEW,
        action_args={
            "prompt": "Has your post 'Earth is flat' been reported? What are your thoughts on this?"
        })

    actions_5[env.agent_graph.get_agent(1)] = ManualAction(
        action_type=ActionType.INTERVIEW,
        action_args={
            "prompt": "Has the post 'Earth is flat' been reported? Please share your thoughts."
        })

    actions_5[env.agent_graph.get_agent(2)] = ManualAction(
        action_type=ActionType.INTERVIEW,
        action_args={
            "prompt": "What are your thoughts on the debate about Earth's shape?"
        })

    await env.step(actions_5)

    # Step 6: Final LLM actions for remaining agents
    actions_6 = {
        agent: LLMAction()
        for _, agent in env.agent_graph.get_agents([3, 5, 7, 9])
    }
    await env.step(actions_6)

    # Close environment
    await env.close()

    # Visualize interview results
    print("\n=== Interview Results ===")
    conn = sqlite3.connect(db_path)
    cursor = conn.cursor()

    # Query all interview records
    cursor.execute(
        """
        SELECT user_id, info, created_at
        FROM trace
        WHERE action = ?
    """, (ActionType.INTERVIEW.value, ))

    # Display interview results
    for user_id, info_json, timestamp in cursor.fetchall():
        info = json.loads(info_json)
        print(f"\nAgent {user_id} (Timestep {timestamp}):")
        print(f"Prompt: {info.get('prompt', 'N/A')}")
        print(f"Interview ID: {info.get('interview_id', 'N/A')}")
        print(f"Response: {info.get('response', 'N/A')}")

    conn.close()


if __name__ == "__main__":
    asyncio.run(main())
```

## How It Works

### 1. Setup and Configuration

Include `ActionType.REPORT_POST` in your available actions list:

```python
available_actions = [
    ActionType.CREATE_POST,
    ActionType.LIKE_POST,
    ActionType.REPORT_POST,  # Include reporting functionality
    ActionType.REPOST,
    ActionType.FOLLOW,
    ActionType.DO_NOTHING,
]
```

### 2. Reporting Posts

Use `ManualAction` with `ActionType.REPORT_POST` to report posts:

```python
# Single report
report_action = ManualAction(
    action_type=ActionType.REPORT_POST,
    action_args={
        "post_id": 1,
        "report_reason": "This is inappropriate content"
    })

actions = {env.agent_graph.get_agent(0): report_action}
await env.step(actions)
```

### 3. Multiple Reports in One Step

You can have multiple agents report the same post:

```python
actions = {}
actions[env.agent_graph.get_agent(1)] = ManualAction(
    action_type=ActionType.REPORT_POST,
    action_args={
        "post_id": 1,
        "report_reason": "This is spam"
    })

actions[env.agent_graph.get_agent(2)] = ManualAction(
    action_type=ActionType.REPORT_POST,
    action_args={
        "post_id": 1,
        "report_reason": "This is misinformation"
    })

await env.step(actions)
```

### 4. Mixing Reports with Other Actions

Reports can be submitted alongside regular social media actions:

```python
actions = {}
# Regular post creation
actions[env.agent_graph.get_agent(1)] = ManualAction(
    action_type=ActionType.CREATE_POST,
    action_args={"content": "Earth is not flat."})

# Report action
actions[env.agent_graph.get_agent(0)] = ManualAction(
    action_type=ActionType.REPORT_POST,
    action_args={
        "post_id": 1,
        "report_reason": "This is misinformation!"
    })

await env.step(actions)
```

## Data Storage and Retrieval

### Database Schema

Report data is stored in the `report` table with the following structure:
- `report_id`: Unique identifier for the report
- `user_id`: The ID of the reporting agent
- `post_id`: The ID of the reported post
- `report_reason`: The reason for the report
- `created_at`: Timestamp of the report

### Retrieving Report Results

```python
import sqlite3
import json

conn = sqlite3.connect(db_path)
cursor = conn.cursor()

# Query all report records
cursor.execute("""
    SELECT report_id, user_id, post_id, report_reason, created_at
    FROM report
    ORDER BY created_at DESC
""")

for report_id, user_id, post_id, reason, timestamp in cursor.fetchall():
    print(f"Report {report_id}:")
    print(f"  User: {user_id}")
    print(f"  Post: {post_id}")
    print(f"  Reason: {reason}")
    print(f"  Time: {timestamp}")

conn.close()
```

## Best Practices

### 1. Strategic Reporting

Consider these factors when implementing reporting:
- Set appropriate reporting thresholds
- Monitor reporting frequency
- Analyze report reason distribution
- Process reported content promptly

### 2. Integration with Other Features

The reporting feature can be integrated with other features:
- Combine with interview functionality to understand user reactions to reports
- Integrate with content moderation systems
- Work with user behavior analysis systems

## Common Use Cases

1. **Content Moderation**:
   - Monitor inappropriate content
   - Track violations
   - Maintain platform quality

2. **User Behavior Analysis**:
   - Analyze reporting patterns
   - Identify problematic users
   - Optimize content strategy

3. **Platform Management**:
   - Automate report processing
   - Generate report summaries
   - Develop management strategies
